﻿import React, {Component, Fragment} from 'react';
import {Table, Tag, Button} from 'antd';
import PropTypes from 'prop-types';

class PurchaseList extends Component {
  // 名称 物料编码 型号 品牌 供应商 销售价 数量 日期
  state = {
    columns: [
      {
        title: '名称',
        dataIndex: 'name',
        key: 'name'
      },
      {
        title: '物料编码',
        dataIndex: 'invcode',
        key: 'invcode'
      },
      {
        title: '型号',
        dataIndex: 'specs',
        key: 'specs'
      },
      {
        title: '品牌',
        dataIndex: 'brand',
        key: 'brand'
      },
      {
        title: '供应商',
        dataIndex: 'vendor_name',
        key: 'vendor_name'
      },
      {
        title: '采购价',
        dataIndex: 'price',
        key: 'price'
      },
      {
        title: '数量',
        dataIndex: 'num',
        key: 'num'
      },
      {
        title: '创建日期',
        dataIndex: 'create_at',
        key: 'create_at'
      },
      {
        title: '需求日期',
        dataIndex: 'demand_date',
        key: 'demand_date'
      }
      // {
      //   title: "操作",
      //   key: "action",
      //   render: (text, record) => {
      //     const {userEdit} = this.props;
      //     return <div className='actionGroup'>
      //       <Button size='small' onClick={() => userEdit(record)}>编辑</Button>
      //       <Button size='small' type='danger' onClick={() => this.props.roleDel(record)}>删除</Button>
      //     </div>;
      //   }
      // }
    ]
  };

  static propTypes = {
    userListData: PropTypes.array,
    userEdit: PropTypes.func,
    roleDel: PropTypes.func
  };

  render() {
    const {columns} = this.state;
    const {purchaseList} = this.props;
    return (
      <div className='historyPurchase'>
        <Table columns={columns} dataSource={purchaseList} pagination={false}/>
      </div>
    );
  }

}

export default PurchaseList;
